<?php

use Illuminate\Http\Request;
use Illuminate\Routing\Router;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::middleware('auth:api')->get('/user', function (Request $request) {
//    return $request->user();
//});

Route::get('/test', 'Api\TestController@test');

Route::group([
    'prefix' => 'v1',
    'namespace' => 'Api',
    'middleware' => 'auth:api'
],
    function (Router $router) {

        // 医生菜单权限
        $router->get('get_menu_list', 'DoctorPermissionController@getMenuList');
        // 切换中心授权
        $router->get('hospitals/authorizations', 'DoctorPermissionController@getAuthorizedDepartmentsUnderHospital');
        // 获取省市区地址
        $router->get('chinese/divisions', 'DoctorPermissionController@getLocationDivisions');


        #############
        ###  病历管理 和 访视就诊相关
        #############
        // 病历管理 - 患者列表
        $router->get('visit/list', 'VisitController@getPatientList');
        // 创建访视
        $router->post('patient/visit/level', 'VisitController@createVisitLevel');
        // 创建就诊
        $router->post('patient/visit/record', 'VisitController@createVisitRecord');
        // 患者访视记录历史
        $router->get('visit/level/history', 'VisitController@getVisitLevelHistory');

        #############
        ###  用户模块
        #############
        // 获取用户信息
        $router->get('patient/info', 'PatientController@info');
        // 保存用户信息并设置入组
        $router->post('patient/save', 'PatientController@saveBasicInfo');
        // 验证垂体入组加入情况
        $router->get('patient/check', 'PatientController@checkIsJoinPituitary');
        // 设置用户是否垂体病和垂体类型
        $router->post('patient/pituitary', 'PatientController@setPituitaryType');


        // 修改手机号时短信发送
        $router->post('patient/change/check', 'PatientController@checkChangeCell');
        // 修改手机号
        $router->post('patient/change/cell', 'PatientController@changeCell');
        // 加入医院
        $router->post('patient/join/hosp', 'PatientController@joinHosp');
        // 加入垂体项目并入组
        $router->post('patient/join', 'PatientController@joinCompany');


        //问卷-yuww -start
        #获取章节
        $router->get('pituitary/template', 'AnswerController@getTemplates');
        #章节下面题目
        $router->get('pituitary/qss/info', 'AnswerController@getQssInfo');
        #保存章节下面的题目
        $router->post('pituitary/qss/info', 'AnswerController@saveQssInfo');
//        $router->post('pituitary/qss/more_info', 'AnswerController@saveQssInfoMoreAnaswer');
        //问卷-yuww -end
        $router->get('completion', 'AnswerController@getCompletion');
        //用药-yuww-start
        # 用药选择列表 
        $router->get("pituitary/drugs", 'DrugController@getDrugs');
        # 用药检查 用药禁忌
        $router->post("pituitary/drug_check", 'DrugController@drugCheck');
        # 新增用药 
        $router->post("pituitary/drug_add", 'DrugController@drugAdd');
        # 编辑用药 
        $router->put("pituitary/drug_edit", 'DrugController@drugEdit');
        # 用药调整  
        $router->put("pituitary/drug_adjust/{id}", 'DrugController@drugAdjust');
        # 用药停药
        $router->put("pituitary/drug_stop/{id}", 'DrugController@drugStop');
        # 删除用药
        $router->delete("pituitary/drug_del/{id}", 'DrugController@drugDel');
        $router->delete("pituitary/drug_del_record/{id}", 'DrugController@drugDelRecord');
        #点击查看用药列表 用药记录
        $router->get("pituitary/drug_records/{id}", 'DrugController@getDrugRecordsList');
        #点击获取用药详细
        $router->get("pituitary/drug_detail/{id}", 'DrugController@getdetailById');
        # 用药列表
        $router->get("pituitary/drug_list", 'DrugController@getDrugList');
        
        # 上传图片
        $router->post("pituitary/upload", 'AnswerController@upload');
 
        ## 新用药关系 -end 


        ###############
        ### 随访管理模块
        ###############
        //随访提醒列表
        $router->get('follow/list', 'NoticeVisitsController@getFollowManageList');
        //联系记录
        $router->get('get_records_list', 'NoticeVisitsController@getUserContactRecordList');
        //保存记录
        $router->post('save_contact_record', 'NoticeVisitsController@saveUserContactRecord');
        // 联系记录-下一个
        $router->get('notice/user/next', 'NoticeVisitsController@getUserNext');
        // 获取医院自定义模板短信ID
        $router->get('sms/get_custom_template', 'NoticeVisitsController@getHospitalCustomSmsTemplate');
        //发送短信提醒
        $router->post('save_sms_notice', 'NoticeVisitsController@saveSmsNotice');

        // 标签管理
        // 院内标签搜索
        $router->get('tags/get/{hosp_id}', 'TagsManageController@getTagsByHospId');
        // 增加标签
        $router->post('tags', 'TagsManageController@createTag');
        // 修改标签
        $router->put('tags', 'TagsManageController@editTagById');
        // 删除标签
        $router->delete('tags', 'TagsManageController@deleteTag');
        //验证标签使用次数
        $router->get('tags/checkcnt', 'TagsManageController@checkTagCnt');
        // 分配标签
        $router->post('tags/assign', 'TagsManageController@assignUserTags');
        // 获取某个科室下某个患者的标签情况
        $router->get('tags/user_tags', 'TagsManageController@getUserTags');

        ###############
        ##### 统计模块
        ###############
        //统计报表
        //管理人数
        $router->get('report/visit/manage_user', 'StatisticsReportController@getManageUserData');
        //垂体各疾病占比
        $router->get('report/visit/pituitary_percent', 'StatisticsReportController@getPituitaryPercent');
        //既往病史占比
        $router->get('report/visit/illness_proportion', 'StatisticsReportController@getIllnessProportion');
        //年龄占比
        $router->get('report/visit/age_proportion', 'StatisticsReportController@getAgeProportion');

    });

 